<template>
  <div v-loading="loading" class="tree">
    <slot :data="treeList"/>
  </div>
</template>

<script>
import { getMenu } from '@/api/base/users'

export default {
  name: 'Index',
  props: {},
  data() {
    return {
      treeList: [],
      loading: false
    }
  },
  created() {
    this.loadData()
  },
  methods: {
    loadData() {
      this.loading = true
      getMenu().then(res => {
        this.loading = false
        res.data[0].title = '菜单'
        this.treeList = res.data
      }).catch(err => {
        this.loading = false
      })
    }
  }
}
</script>

<style scoped>

</style>
